<?php
//viewAssignment_instructor.php
//provides the instructor's view of the home page - jlg
//This page cannot be accessed externally, only pulled in by the viewAssignment.php file.
if (!isset($allow)) { $allow=false; }
require_once("overhead.php");
$crumb["link"]="index.php?cid=".$currentCourse."&uid=".$currentUser."&role=".$currentRole;
$crumb["title"]="Course Home";
$breadcrumbs[]=$crumb;
$pageTitle="Assignment Summary for '".$assignmentData['Name']."'";
printBreadcrumbs();

$submissions=null;
$submissionListQuery=mysql_query("select UserID, Date, Score from submission where AssignmentID=".$assignmentData['ID']." order by Date desc");
while($row=mysql_fetch_assoc($submissionListQuery)) {
	$submission["UserID"]=$row["UserID"];
	$submission["Date"]=$row["Date"];
	$submission["Score"]=($row["Score"]==null ? "<i>no score assigned</i>" : $row['Score']);
	$submissions[]=$submission;
}
print "<h2>".$assignmentData['Name']."</h2><font color='orange'>".$_REQUEST['msg']."</font><br />";
print "<strong>Assignment Status:</strong> ".$assignmentData['Status']."<br />";
print "<br />";
print "<strong>JUnit Test:</strong> ".$assignmentData['JUnit Test']."<br />";
print "<strong>Description:</strong> <br />";
print str_replace("\n","<br />",$assignmentData['Description']);
print "<br />";
print "<a href='editAssignment.php?aid=".$assignmentData['ID']."'>Edit this assignment</a>";
print "<h3>Current Submissions: (".count($submissions).")</h3>";
if (count($submissions)>0) { print "<ul>"; }
foreach ($submissions as $submission) {
	print "<li>".$submission["UserID"].": ".$submission["Score"]." (".$submission['Date'].")</li>";
}
if (count($submissions)>0) { print "</ul>"; }

?>